package com.suxin.spring.config;

import lombok.Getter;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.stereotype.Component;

/**
 * @author Tang
 * @classname ScheduleConfig
 * @description [  ]
 * @date 2021/8/1 16:29
 */
@Component
public class DefaultScheduleConfigurer implements SchedulingConfigurer {

    @Getter
    private ScheduledTaskRegistrar scheduledTaskRegistrar;

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        this.scheduledTaskRegistrar = taskRegistrar;
        taskRegistrar.setTaskScheduler(new DefaultThreadPoolTaskScheduler(20,
                "my-threadPoolTaskScheduler-"));
    }

}